﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="废料入库_In.aspx.cs" Inherits="syc.Store.废料入库_In" %>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript" language="javascript" src="/common.js"></script>
<form id="form1" runat="server">
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
SelectCommand="SELECT @废料ID=t1.废料ID,@单位ID=t1.单位ID
,@数量0=t1.数量0,@数量=t1.数量,@单价=t1.单价,@日期=t1.日期
,@备注=t1.备注,@单据号=t1.单据号
,@废料名称=t2.废料名称,@规格=t2.规格,@单位=t2.单位
,@单位名称=t3.名称
FROM 废料入出库 t1
left outer join 废料 t2 on t2.ID=t1.废料ID
left outer join 生产单位 t3 on t3.ID=t1.单位ID where t1.ID=@ID and t1.入出=0;"
 InsertCommand="insert 废料入出库([单据号],[废料ID],[单位ID],[入出],[日期],[数量0],[数量],[单价],[单价1],[金额1],[备注],[保管员])
     VALUES(@废料ID,@单位ID,0,@日期,0,@数量,@单价,0,0,0,'','')"
UpdateCommand="update 废料入出库 set 日期=@日期,单据号=@单据号,备注=@备注,单价=@单价 where ID=@ID;"
ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
    oninserted="SqlDataSource1_Inserted" onselected="SqlDataSource1_Selected" 
    onupdated="SqlDataSource1_Updated" >
<SelectParameters>
<asp:Parameter Name="ID" DbType="Int32" Size="4" DefaultValue="0" />
<asp:Parameter Name="废料ID" DbType="Int32" Size="4" Direction="Output" />
<asp:Parameter Name="单位ID" DbType="Int32" Size="4" Direction="Output" />
<asp:Parameter Name="数量0" DbType="Double" Size="9" Direction="Output" />
<asp:Parameter Name="数量" DbType="Double" Size="9" Direction="Output" />
<asp:Parameter Name="单价" DbType="Double" Size="13" Direction="Output" />
<asp:Parameter Name="日期" DbType="Date" Size="3" Direction="Output" />
<asp:Parameter Name="备注" DbType="String"  Size="100" Direction="Output" />
<asp:Parameter Name="废料名称" DbType="String"  Size="40" Direction="Output" />
<asp:Parameter Name="规格" DbType="String"  Size="40" Direction="Output" />
<asp:Parameter Name="单位" DbType="String"  Size="20" Direction="Output" />

<asp:Parameter Name="单位名称" DbType="String" Size="40" Direction="Output" />
<asp:Parameter Name="记录数" DbType="Int32" Size="4" Direction="Output" DefaultValue="0" />
<asp:Parameter Name="单据号" DbType="Int32" Size="4" Direction="Output"/>
</SelectParameters>
<InsertParameters>
<asp:Parameter Name="ID" DbType="Int32" Size="4" Direction="Output" />
<asp:ControlParameter Name="废料ID" DbType="Int32" Size="4" ControlID="Label_CLID"/>
<asp:ControlParameter Name="单位ID" DbType="Int32" Size="4" ControlID="Label_DWID"/>
<asp:ControlParameter Name="数量" DbType="Decimal" Size="9" ControlID="Label_ShuLiang"/>
<asp:ControlParameter Name="单价" DbType="Decimal" Size="13" ControlID="DanJia"/>
<asp:ControlParameter Name="日期" DbType="Date" Size="3" ControlID="Date1"/>
<asp:ControlParameter Name="单据号" DbType="Int32" Size="4" ControlID="DanHao"/>
<asp:ControlParameter Name="备注" DbType="String"  Size="100" ControlID="BeiZhu"/>
<asp:ControlParameter Name="记录数" DbType="Int32" Size="4" ControlID="Label_Record"/>
<asp:Parameter Name="保管员" DbType="String" Size="20" />
</InsertParameters>
<UpdateParameters>
<asp:ControlParameter Name="ID" DbType="Int32" Size="4" ControlID="Label_ID"/>
<asp:ControlParameter Name="日期" DbType="Date" Size="3" ControlID="Date1"/>
<asp:ControlParameter Name="单据号" DbType="Int32" Size="4" ControlID="DanHao"/>
<asp:ControlParameter Name="备注" DbType="String"  Size="100" ControlID="BeiZhu"/>
<asp:ControlParameter Name="单价" DbType="Decimal" Size="13" ControlID="DanJia"/>
</UpdateParameters>
</asp:SqlDataSource>

<asp:Label ID="Label_ID" runat="server" Text="0" Visible="false"></asp:Label>
<asp:Label ID="Label_CLID" runat="server" Text="0" Visible="false"></asp:Label>
<asp:Label ID="Label_DWID" runat="server" Text="0" Visible="false"></asp:Label>
<asp:Label ID="Label_List" runat="server" Text="" Visible="false"></asp:Label>
<asp:Label ID="Label_Record" runat="server" Text="0" Visible="false"></asp:Label>


<div id="wintop" class="wintop" style="display:none;">废料入库单录入</div>
<asp:Panel ID="Panel1" runat="server" CssClass="panel">
    <asp:Button ID="Button_Save" runat="server" Text="保 存" UseSubmitBehavior="false"
            CssClass="button" onclick="Button_Save_Click"  />
    <asp:Button ID="Button_Close" runat="server" Text="关 闭" UseSubmitBehavior="false"  Visible="true"
            CssClass="button" OnClientClick="parent.swin2_close();return false;" />
</asp:Panel>

<asp:Panel ID="Panel2" runat="server" CssClass="panel">
日期：<asp:TextBox ID="Date1" runat="server" CssClass="textbox" Width="105px"></asp:TextBox><img alt="" src="/Icons/29.png" align="middle" onclick="makecalendar(document.getElementById('Date1').value, document.getElementById('Date1'));" />
<span style="margin-left:5px;"></span>单号：<asp:TextBox ID="DanHao" runat="server" CssClass="textbox" Width="60px"></asp:TextBox>
<span style="margin-left:5px;"></span>单价：<asp:TextBox ID="DanJia" runat="server" CssClass="textbox" Width="80px"></asp:TextBox>元
<span style="margin-left:5px;"></span>备注：<asp:TextBox ID="BeiZhu" runat="server" CssClass="textbox" Width="200px"></asp:TextBox>
</asp:Panel>
<asp:Panel ID="Panel3" runat="server">

<script>    putBillHead();</script>
<style>
td.bb{border:0.5pt solid #000000;text-align:center;}
</style>
<table border="0" cellpadding="0" style="border-collapse: collapse;font-size:14px;">
<tr>
<td colspan="7" style="font-size:24px;height:36px;" align="center">陕西延长石油材料有限公司<br />
    废料入库单</td>
</tr>
<tr>
<td colspan="3" height="24">编码：SYC/ZJ-WL-01</td>
<td colspan="4" ></td>
</tr>
<tr>
<td colspan="2" height="24">填报单位：<asp:Label ID="Label_GongHuo" runat="server" Text=""></asp:Label></td>
<td colspan="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span id="DateText"></span></td>
<td colspan="1" align="right" style="color:red;padding-right:10px;">No.<span ID="DanHaoText"></span></td>
</tr>
<tr>
<td class="bb" rowspan="2" width="130" height="48">材料编码</td>
<td class="bb" rowspan="2" width="130" height="48">材料名称</td>
<td class="bb" rowspan="2" width="130">规格及材质</td>
<td class="bb" rowspan="2" width="50">单位</td>
<td class="bb" >数量</td>

<td class="bb"  colspan="2">价格</td>

</tr>
<tr>

<td class="bb" width="70">实收</td>
<td class="bb" width="85">单价</td>
<td class="bb" width="85" >金额</td>
</tr>
<tr>
<td class="bb" height="30" width="130"><asp:Label ID="Label_BianMa" runat="server" Text=""></asp:Label></td>
<td class="bb" height="30" width="130"><asp:Label ID="Label_CaiLiao" runat="server" Text=""></asp:Label></td>
<td class="bb" width="130"><asp:Label ID="Label_GuiGe" runat="server" Text=""></asp:Label></td>
<td class="bb" width="50"><asp:Label ID="Label_DanWei" runat="server" Text=""></asp:Label></td>

<td class="bb" width="70"><asp:Label ID="Label_ShuLiang" runat="server" Text=""></asp:Label></td>
<td class="bb" width="70"><asp:Label ID="Label_DanJia" runat="server" Text=""></asp:Label></td>
<td class="bb" width="70" ><asp:Label ID="Label_JinE" runat="server" Text=""></asp:Label></td>

</tr>
<tr>
<td class="bb" height="40">备注</td>
<td class="bb" colspan="6" style="text-align:left;"><div id="BeiZhuText"></div></td>
</tr>
<tr>
<td height="24">主管：</td>
<td colspan="2">计划员：</td>
<td colspan="2">保管员：</td>
<td colspan="2">　采购：</td>
</tr>
</table>
<script>    putBillFoot();</script>
</asp:Panel>



</form>

<script >
    var notice = "<%=this.Notice %>";
    if (notice != "") {
        parent.showmsgbox(notice);
    }

    var textboxs = document.getElementsByTagName("input");
    var i;
    for (i = 0; i < textboxs.length; i++) {
        if (textboxs[i].className == "pageturn" || textboxs[i].className == "intxt1" || textboxs[i].className == "textbox") {
            textboxs[i].onfocus = function(e) { this.select(); };
        }
    }

    document.onkeydown = function(e) {
        if (!e) e = window.event;
        var tag = e.srcElement;
        if (!tag) tag = e.target;
        if (tag.id == "BeiZhu") return;
        if (tag.tagName == "INPUT" && tag.className == "textbox" || tag.tagName == "SELECT" || tag.tagName == "DIV") {
            if (e.keyCode == 13) {
                e.keyCode = 9;
            }
        }
        else if (e.keyCode == 8) {
            return false;
        }
    }
    var baocun = document.getElementById("Button_Save");
     
    document.getElementById("Date1").onchange = function() {
        document.getElementById("DateText").innerHTML = this.value;        
    };
    document.getElementById("DanHao").onchange = function() {
        document.getElementById("DanHaoText").innerHTML = "0000000".substr(this.value.length) + this.value;
    };
    document.getElementById("DanJia").onchange = function() {
        document.getElementById("Label_DanJia").innerHTML = this.value;
        document.getElementById("Label_JinE").innerHTML = this.value * document.getElementById("Label_ShuLiang").innerHTML;
    };
    document.getElementById("BeiZhu").onchange = function() {
        document.getElementById("BeiZhuText").innerHTML = this.value;
    };

    document.getElementById("Date1").onchange();
    document.getElementById("DanHao").onchange();
    document.getElementById("DanJia").onchange();
    document.getElementById("BeiZhu").onchange();
    
</script>
</body>
</html>
